package com.elsa.smart_buffet.test1;

import com.elsa.smart_buffet.mapper.*;
import com.elsa.smart_buffet.pojo.Report;
import com.elsa.smart_buffet.service.ConsumerService;
import com.elsa.smart_buffet.service.MenuPriceService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.List;

/**
 * @ClassName : testMenu  //类名
 * @Author : elsa //作者
 */
@RunWith(SpringRunner.class)
@WebAppConfiguration
@SpringBootTest()
@Slf4j
public class testMenu {

    @Autowired
    private MenuMapper menuMapper;

    @Autowired
    private ConsumerMapper consumerMapper;

    @Autowired
    private ConsumerService consumerService;

    @Autowired
    private EvaluateMapper evaluateMapper;

    @Autowired
    private MenuPriceMapper menuPriceMapper;

    @Autowired
    private MenuPriceService menuPriceService;

    @Autowired
    private ReportMapper reportMapper;

    @Autowired
    private FeedbackMapper feedbackMapper;

    @Test
    public void testreportMapper() {
        Report reportList = reportMapper.selectById(1);
        log.info(String.valueOf(reportList));
    }

    @Test
    public void selectReportInOrderByTime() {
        List<Report> reportList = feedbackMapper.selectReportInOrderByTime("2023-05-01", "2023-06-01");
        log.info(String.valueOf(reportList));
    }

    @Test
    public void selectReportBySearchData() {
        List<Report> reportList = feedbackMapper.selectReportBySearchData("errqw");
        log.info(String.valueOf(reportList));
    }


    @Test
    public void testMenu() {
        int res = menuMapper.selectMCategoryCount();
        log.info(String.valueOf(res));
    }

    @Test
    public void testMenu1() {

        log.info(String.valueOf(menuMapper.selectList(null)));
    }

    @Test
    public void testGetConsumerByTimeAndSex() {

        log.info(String.valueOf(consumerService.getConsumerByTimeAndSex("2023/03/01-2023/03/18-男")));
    }

    @Test
    public void testGetConsumerBySearchData() {

        log.info(String.valueOf(consumerMapper.getConsumerBySearchData("13123241245")));
    }

    @Test
    public void testSelectMenuByCategory() {

        log.info(String.valueOf(menuMapper.selectMenuByCategory("2")));
    }

    @Test
    public void testSelectMenuBySearchData() {

        log.info(String.valueOf(menuMapper.selectMenuBySearchData("菜")));
    }

    @Test
    public void testSelectEvaluateByTime() {

        log.info(String.valueOf(evaluateMapper.selectEvaluateByTime("2023-03-01", "2023-03-22")));
    }

    @Test
    public void testSelectEvaluateBySearchData() {

        log.info(String.valueOf(evaluateMapper.selectEvaluateBySearchData("hhh")));
    }

    @Test
    public void testMenuPriceMapper() {
        log.info(String.valueOf(menuPriceMapper.getMenuPriceByTime("20230323")));
    }

    @Test
    public void testMenuPriceService() {
        log.info(String.valueOf(menuPriceService.getMenuPriceByTime("20230323")));
    }

}
